// KEPServerEX: Shows how to write into multiple OPC items using a single method call, and read multiple item values back. // // Find all latest examples here: https://www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio/Latest/examples.html . // OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-ConnectivityStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://forum.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System; using System.Diagnostics; using OpcLabs.BaseLib.OperationModel; using OpcLabs.EasyOpc.DataAccess; using OpcLabs.EasyOpc.DataAccess.OperationModel; namespace DocExamples.Specialized { partial class Kepware_KEPServerEX { public static void WriteMultipleItemValues() { // Instantiate the client object. var client = new EasyDAClient(); Console.WriteLine("Writing multiple item values..."); OperationResult[] resultArray = client.WriteMultipleItemValues( new[] { new DAItemValueArguments( "Kepware.KEPServerEX.V6", "Data Type Examples.16 Bit Device.K Registers.Long1", 12345), new DAItemValueArguments( "Kepware.KEPServerEX.V6", "Data Type Examples.16 Bit Device.K Registers.Boolean1", true), new DAItemValueArguments( "Kepware.KEPServerEX.V6", "Data Type Examples.16 Bit Device.K Registers.Double1", 234.56), new DAItemValueArguments("Kepware.KEPServerEX.V6", "Data Type Examples.16 Bit Device.S Registers.String1", "ABC") }); for (int i = 0; i < resultArray.Length; i++) { Debug.Assert(resultArray[i] != null); if (resultArray[i].Succeeded) Console.WriteLine("Result {0}: success", i); else { Debug.Assert(!(resultArray[i].Exception is null)); Console.WriteLine("Result {0} *** Failure: {1}", i, resultArray[i].ErrorMessageBrief); } } } } }
Copyright © 2004-2026 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Documentation Home, Send Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.
Follow us on X (Twitter) | Follow us on LinkedIn